package com.jinmdz.fmis.mapper.mapper;

import com.jinmdz.fmis.mapper.entity.ChargeSettlePayEntity;
import com.jinmdz.fmis.mapper.mapper.provider.ChargeSettlePayProvider;
import org.apache.ibatis.annotations.*;

import java.util.ArrayList;

/**
 * 费用结算付款表Mapper
 *
 * @author generator
 * @date 2020-03-12 17:08
 */
public interface ChargeSettlePayMapper {

    /**
     * 增加ChargeSettlePay
     *
     * @param entity 数据实体
     * @return
     * @author generator
     * @date 2020-03-12 17:08
     */
    @InsertProvider(type = ChargeSettlePayProvider.class, method = "insertChargeSettlePay")
    @Options(useGeneratedKeys = true, keyProperty = "entity.id", keyColumn = "id")
    void insertChargeSettlePay(@Param("entity") ChargeSettlePayEntity entity);

    /**
     * 删除ChargeSettlePay
     *
     * @param id             主键
     * @param modifiedUserId 修改用户外键
     * @param version        版本号
     * @return
     * @author generator
     * @date 2020-03-12 17:08
     */
    @Update(" update charge_settle_pay set deleted = 1,modified_user_id = #{modifiedUserId},version = unix_timestamp(now()) where id = #{id} and version = #{version} and unmodified = 0 and deleted = 0 ")
    void deletedForChargeSettlePay(@Param("id") Integer id, @Param("modifiedUserId") Integer modifiedUserId, @Param("version") Long version);

    /**
     * 修改ChargeSettlePay
     *
     * @param entity 数据实体
     * @return
     * @author generator
     * @date 2020-03-12 17:08
     */
    @UpdateProvider(type = ChargeSettlePayProvider.class, method = "updateChargeSettlePay")
    void updateChargeSettlePay(@Param("entity") ChargeSettlePayEntity entity);

    /**
     * 查询ChargeSettlePay实体
     *
     * @param id 主键
     * @return ChargeSettlePayEntity
     * @author generator
     * @date 2020-03-12 17:08
     */
    @Select(" select id,deleted,business_code,charge_settle_id,pay_type_code,pay_charge,pay_time,account_unit,random_code,funeral_parlour_code,create_user_id,gmt_create,unmodified,modified_user_id,gmt_modified,version from charge_settle_pay where id = #{id} and deleted = 0 limit 1 ")
    ChargeSettlePayEntity getChargeSettlePayById(@Param("id") Integer id);

    /**
     * 查询ChargeSettlePay列表
     *
     * @param entity 数据实体
     * @return ChargeSettlePayEntity
     * @author generator
     * @date 2020-03-12 17:08
     */
    @SelectProvider(type = ChargeSettlePayProvider.class, method = "listChargeSettlePay")
    ArrayList<ChargeSettlePayEntity> listChargeSettlePay(@Param("entity") ChargeSettlePayEntity entity);
}